<template>
    <Navi title="修改密码" :back="true"></Navi>
    <input class="wjhinput" v-model="data.before_pwd" type="text" name="" id="" placeholder="请输入登录密码">
    <input class="wjhinput" v-model="data.first_pwd" type="text" name="" id="" placeholder="请输入新的登录密码">
    <input class="wjhinput" v-model="data.second_pwd" type="text" name="" id="" placeholder="请确认新的登录密码">
    <button class="" @click="changePwd()">确认</button>
    
</template>
<script setup>
import {reactive,getCurrentInstance, watch} from 'vue'
import {useRouter} from 'vue-router'
const {proxy}=getCurrentInstance()
const data=reactive({
    before_pwd:'',
    first_pwd:'',
    second_pwd:'',
    ready:false
})
// this.$lhl.fetch('post','login/',{
//     username:'admin',
//     password:'password'
// },res=>{
//     console.log(res)
// })
watch(
    ()=>data,
    (newval)=>{
        data.ready=!(Object.values(newval).includes(''))
    },
    {deep:true}
)
const changePwd=()=>{
    proxy.$ajax.post('change_pwd',{
        before_pwd:data.before_pwd,
        now_pwd:data.first_pwd
    })
}
</script>
<style lang="less" scoped>
input{
        background: #e8e8e8;
    height: 100rem;
    margin: 10rem 40rem;
    width: -webkit-fill-available;
}
button{
    width: -webkit-fill-available;
    height: 80rem;
    background: greenyellow;
    text-align: center;
    line-height: 1;
    color: #fff;
    font: 600 30rem normal;
    margin: 10rem 40rem;
    border-radius: 40rem;
    margin-top: 200rem;
}
</style>

